home *** CD-ROM | disk | FTP | other *** search
- Path: hubcap.clemson.edu!hubcap!mjs
- From: mjs@hubcap.clemson.edu (M. J. Saltzman)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: Statistically Random Number algorithm
- Date: 18 Mar 96 23:00:32 GMT
- Organization: Clemson University
- Message-ID: <mjs.827190032@hubcap>
- References: <314D0B67.3C16@psu.edu> <4ikle5$1rf@sparcserver.lrz-muenchen.de>
- NNTP-Posting-Host: hubcap.clemson.edu
- X-Newsreader: NN version 6.5.0 #1
-
- watzka@stat.uni-muenchen.de (Kurt Watzka) writes:
-
- >"Jason A. Soloff" <jas251@psu.edu> writes:
-
- >>I am working on a monte carlo simulation program to model some problems
- >>in astronomy. One thing I am running into, however, is the problem of
- >>the pseudo-random number tables. Does anyone have an algorithm (or
- >>code) for a truly statistically random number generator?
-
- >A guy from NASA once suggested that it is really simple. All you need
- >is a satelite that records the background radiation. You digitize
- >that and have a perfectly random sequence of random numbers.
-
- In a seminar that I saw, Percy Diaconis (the Harvard
- mathematician/magician known for some results about card shuffling)
- pointed out that some experiments with using atomic particle decay to
- produce random bits produced notoriously bad results, based on even
- simple tests for randomness.
-
- >For us mere mortals, the quote from John v. Neumann still holds:
-
- > Anyone who considers arithmetical methods of producing
- > random digits is, of course, in a state of sin.
-
- >So, the answer for C (and C++) still is: Use rand(). If rand() is not
- >good enough for you, maybe the random number generators available
- >on your system will be a solution.
-
- If you are serious about generating random numbers, the rand()
- facility on many systems will not be suitable. The drand48 facility
- available on many Unix systems is better. Numerical Recipes actaully
- has a fairly decent one (according to Diaconis). And there are
- others--some generators and test codes are available from
- Netlib (http://www.netlib.org), for instance.
-
- >The word algorithm implies a _deterministic_ process, and there
- >cannot be a deterministic process that produces _random_ output.
-
- Actually, there is a whole field of _randomized algorithms_. One can
- design algorithms that make random choices at certain points, and
- analyse their probabilistic complexity and/or liklihood of success.
- For example, randomized algorithms might run much faster than
- deterministic ones, but with some probability of failure. One might
- run such an algorithm several times to reduce the failure probability
- to something negligible, and still save time over a deterministic
- method.
-
- Of course, the random component is an *input* to such an algorithm,
- not an output. If one wanted to *implement* a randomized algorithm
- (and get the predicted behavior) one would need a good random number
- generator...
- --
- Matthew Saltzman
- Clemson University Math Sciences
- mjs@clemson.edu
-